package _022_2_12

import "sort"

func containsDuplicate2(nums []int) bool {
	m := map[int]int{}

	for i := 0; i < len(nums); i++ {
		_, ok := m[nums[i]]

		if ok {
			return true
		}
		m[nums[i]] = 1
	}

	return true
}

func containsDuplicate(nums []int) bool {
	sort.Ints(nums)

	for i := 0; i < len(nums)-1; i++ {
		if nums[i] == nums[i+1] {
			return true
		}

	}

	return false
}
